package utils

import (
	"context"
	"fmt"
	"ylm.sl/common/utils/bloomfilter"
)

type BloomFilter struct {
	Name string
	Bf   *bloomfilter.RedisBloomFilter
}

func (bf BloomFilter) Add(ctx context.Context, key string) {
	if err := bf.Bf.Add(ctx, key); err != nil {
		fmt.Printf("RedisBloomFilter Add feil, key:%v", key)
	}
}
func (bf BloomFilter) Contains(ctx context.Context, key string) bool {
	ret, err := bf.Bf.Contains(ctx, key)
	if err != nil {
		return false
	}
	return ret
}
